package com.cn.serverline.lineicp.workshopPlan.controller;

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import javax.annotation.Resource;

import com.cn.serverline.lineicp.workshopPlan.entity.PlanLineSchedule;
import com.cn.serverline.lineicp.workshopPlan.service.IPlanLineScheduleService;
import org.springframework.validation.annotation.Validated;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 周部装排产下发 接口
 *
 * @author 田江余
 * @since 2024-08-10
 */
@RestController
@ApiResource(name = "周部装排产下发的接口")
public class PlanLineScheduleController {

    @Resource(name = "PlanLineScheduleServiceImpl")
    private IPlanLineScheduleService iPlanLineScheduleService;

    /**
     * 添加周部装排产下发
     */
    @PostResource(name = "添加周部装排产下发", path = "/workshopPlan/planLineSchedule/add")
    public ResponseData<PlanLineSchedule> add(@RequestBody @Validated PlanLineSchedule planLineSchedule){
        iPlanLineScheduleService.add(planLineSchedule);
        return new SuccessResponseData<>();
    }

    /**
     * 删除周部装排产下发 撤回
     */
    @PostResource(name = "删除周部装排产下发", path = "/workshopPlan/planLineSchedule/delete")
    public ResponseData<?> delete(@RequestBody @Validated PlanLineSchedule  planLineSchedule){
        iPlanLineScheduleService.del(planLineSchedule);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑周部装排产下发
     */
    @PostResource(name = "编辑周部装排产下发", path = "/workshopPlan/planLineSchedule/edit")
    public ResponseData<?> edit(@RequestBody @Validated PlanLineSchedule planLineSchedule) {
        iPlanLineScheduleService.edit(planLineSchedule);
        return new SuccessResponseData<>();
    }

    /**
     * 分页查询-周部装排产下发列表
     */
    @GetResource(name = "分页查询-周部装排产下发列表", path = "/workshopPlan/planLineSchedule/page")
    public ResponseData<PageResult<PlanLineSchedule>> page(PlanLineSchedule planLineSchedule) {
        return new SuccessResponseData<>(iPlanLineScheduleService.findPage(planLineSchedule));
    }

}
